/**
 * CEP Mobile on Android 2012
 */
package com.orange.cepmobile.android.listener;

import android.content.Context;

/**
 * Listener class
 * @author gqxg9096 STAG FO
 *
 */

public abstract class Listener {
	private boolean registered;

	public boolean isRegistered() {
		return registered;
	}

	public boolean register(final Context context) {
		registered = false;
		if (registerImpl(context)) {
			registered = true;
			return true;
		}
		return false;
	}

	protected abstract boolean registerImpl(final Context context);

	public boolean unregister(final Context context) {
		if (unregisterImpl(context)) {
			registered = false;
			return true;
		}
		return false;
	}

	protected abstract boolean unregisterImpl(final Context context);
}
